<?php
if(isset($_POST['ID'])){
        $ID = $_POST['ID'];
        $dealerCode = $_POST['dealerCode'];
        $numColspan = $_POST['numColspan'] + 7;
        $totalShowRecord = $_POST['totalShowRecord'];
        $db = new Database();
        $dataShow = $db->query("SELECT * FROM tbdealer WHERE id>'$ID' and dealerCode='$dealerCode' and expiryDate > CURDATE()  LIMIT 5","array");
        $count = $db->query("SELECT * FROM tbdealer WHERE id>'$ID' and dealerCode='$dealerCode' and expiryDate > CURDATE()  LIMIT 5","numrows");
        echo "<tr>";
        $ctt = $totalShowRecord+1;
        foreach($dataShow as $data)
        {
        $loadID = $data['id'];
            
            //echo "<td id='count_".$loadID."' rel='0'>".$ctt."</td>";
            $dealerPoints = $data['pointsEarned'];
            
            foreach (extractForms($dealerPoints) as $key => $value) {
                        if(isset($total[$key]))
                                $total[$key] += $value; 
                            else
                                $total[$key] = $value;
                        echo "<td>".$td." ".$value."<br>(".$key.")"."</td>";
                    }
            echo "<td>".$data['expiryDate']."</td></tr>";
            $ctt++;
            
        }
        ?>
        <tr id="more_<?php echo $loadID; ?>">
                <td colspan="<?php echo $numColspan;?>">
                    <div class="morebox">
                    <a href="" class="more" id="<?php echo $loadID; ?>" rel="<?php echo $dealerCode; ?>" numColspan="<?php echo $numColspan; ?>">more</a>
                    </div>
                </td>
            </tr>
        <?php
}
